<?php

namespace app\admin\model;

use think\Model;

/**
 * 社群售卖反馈表
 * Class ResourceSaleFeedback
 * @package app\admin\model
 */
class ResourceSaleFeedback extends Model
{
    /**
     * 获取反馈
     * @param $where
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function findResourceSaleFeedback($where)
    {
        $info = self::alias('f')
            ->join('resource_sale_feedback_sub s', 'f.id = s.fid', 'left')
            ->join('users u', 's.uid = u.id', 'left')
            ->field('f.*,s.fid,u.nickname,u.headimg')
            ->where($where)
            ->find();
        return $info ? $info->toArray() : [];
    }

    /**
     * 更新反馈
     * @param $data
     * @param $where
     * @return ResourceSaleFeedback
     */
    public static function updateResourceSaleFeedback($data, $where)
    {
        return self::update($data, $where);
    }

}